package cn.richard.base.view

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 *
 * @ProjectName: PicApp
 * @Author: wuzhiguo@aiforward.com
 * @CreateDate: 2021/9/1 5:39 下午
 * @Description:
 */
abstract class BaseActivity<T : ViewDataBinding>: AppCompatActivity() {

    protected lateinit var mBinding: T

    override fun onCreate(savedInstanceState: Bundle?) {
        setContentBefore()
        super.onCreate(savedInstanceState)

        mBinding = DataBindingUtil.setContentView(this, getLayoutId())

        initView()
        initObserver()
        initData()
    }


    abstract fun getLayoutId(): Int
    abstract fun initView()
    abstract fun initData()

    open fun setContentBefore(){
        //设置view之前调用
    }

    open fun initObserver() {}
}